package com.xinqi.modules.prepare.courseware.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.prepare.courseware.dto.req.PrepareCoursewarePartQueryDTO;
import com.xinqi.modules.prepare.courseware.dto.rsp.PrepareCoursewarePartResultDTO;
import com.xinqi.modules.prepare.courseware.service.PrepareCoursewarePartService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 备课区互动课件切片内部控制层
 *
 * @author: system
 * @date: 2023/03/19
 */
@Hidden
@RestController
@RequestMapping("/inner/prepare-courseware-part")
@RequiredArgsConstructor
public class PrepareCoursewarePartInnerController {
    private final PrepareCoursewarePartService prepareCoursewarePartService;

    /**
     * 备课区互动课件切片-分页
     */
    @GetMapping("/page")
    public R<PageInfo<PrepareCoursewarePartResultDTO>> page(Param pageable, PrepareCoursewarePartQueryDTO dto) {
        PageInfo<PrepareCoursewarePartResultDTO> page = prepareCoursewarePartService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 备课区互动课件切片-详情
     */
    @GetMapping("/{id}")
    public R<PrepareCoursewarePartResultDTO> findById(@PathVariable("id") Long id) {
        PrepareCoursewarePartResultDTO dto = prepareCoursewarePartService.findById(id);
        return R.data(dto);
    }
}
